<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>审核</title>
<link rel="stylesheet" href="../../css/bootstrap.min.css"> 
<style type="text/css">
#myDiv{
	width:500px;
	margin-left: 250px;
	margin-top: 100px;
}
#topDiv{
	position: relative;
	height: 150px;
}
#bottomDiv{
	position: relative;
	margin-left: -100px;
}
#leftDiv {
	margin-top:30px;
	width: 220px;
	float: left;
}
#rightDiv {
	margin-top:30px;
	width: 200px;
	float: right;
}
.pager{
	margin-top: 100px;
}
</style>
</head>
<body>
	<div id="myDiv">
		<div id="topDiv">
			<div id="leftDiv">
			<br>
				<label>用户名：</label><label id="userName"></label><br><br><br>
				<label>身份证号：</label><label id="ladyCard"></label><br><br><br>
				<label>家庭地址：</label><label id="ladyAddress"></label><br><br><br>
			</div>
			<div id="rightDiv">
			<br>
				<label>真实姓名：</label><label id="ladyName"></label><br><br><br>
				<label>电话号码：</label><label id="ladyTel"></label><br><br><br>
				<label>职业描述：</label><label id="ladyDescribe"></label><br><br><br>
			</div>
		</div>
		<div id="bottomDiv">
			<ul class="pager">
				<li><input type="hidden" id="currentPage" name="currentPage" ></li>
				<li><input type="hidden" id="userID" name="userID" value="${sessionScope.myOperator.user.userID }"  ></li>
				<li><input type="hidden" id="landladyID" name="landladyID"></li>
				<li><a href="javascript:void(0)" id="passBtn">通过</a></li>
				<li>&nbsp;&nbsp;&nbsp;&nbsp;</li>
				<li><a href="javascript:void(0)" id="refuseBtn">未通过</a></li>
			</ul>
		</div>
	</div>
	<script type="text/javascript" src="../../js/jquery-3.1.0.min.js"></script>
	<script type="text/javascript">
	$(function (){
		init();
	})
	function init(){
		//保存请求或session 的userID和landladyID
		$("#landladyID").val(<%= request.getParameter("landladyID")%>);
		$("#currentPage").val(<%= request.getParameter("currentPage")%>);
		fillLabels();
	}
	//填充页面上的label内容
	function fillLabels(){
		var landladyID = $("#landladyID").val();
		$.ajax({
			type : "POST",
			url : "findLandladyByLadyID.do", 
			data : {
				"landladyID" : landladyID
			},
			success : function(landLady) {
				$("#userName").html(landLady.user.userName);
				$("#ladyCard").html(landLady.ladyCard);
				$("#ladyAddress").html(landLady.ladyAddress);
				$("#ladyName").html(landLady.ladyName);
				$("#ladyTel").html(landLady.ladyTel);
				$("#ladyDescribe").html(landLady.ladyDescribe);
			}
		});
	}
	//通过  改变landlady状态后返回之前页面
	$("#passBtn").on("click",function(){
		//async:false,
		var landladyID = $("#landladyID").val();
		$.ajax({
			type : "POST",
			url : "passLandladyRequest.do", 
			data : {
				"landladyID" : landladyID
			},
			success : function() {
				var currentPage = $("#currentPage").val();
				window.location.href="ensureLandlady.jsp?currentPage="+currentPage;
			}
		})
	})
	//不通过  返回之前页面
	$("#refuseBtn").on("click",function(){
		var currentPage = $("#currentPage").val();
		var landladyID = $("#landladyID").val();
		$.ajax({
			type : "POST",
			url : "refuseLandladyRequest.do", 
			data : {
				"landladyID" : landladyID
			},
			success : function() {
				window.location.href="ensureLandlady.jsp?currentPage="+currentPage;
			}
		})
	})
	</script>
</body>
</html>